package com.fly.main;

import org.springframework.context.support.GenericXmlApplicationContext;

import com.fly.dao.TMeasureDAO;
import com.fly.service.TMeasureService;
import com.fly.service.UsersService;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 * MainRun
 * 
 * @author 00fly
 * @version [版本号, 2018-09-11]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Slf4j
public class MainRun
{
    /**
     * 测试Main
     * 
     * @param args
     * @see [类、类#方法、类#成员]
     */
    public static void main(String[] args)
    {
        GenericXmlApplicationContext context = new GenericXmlApplicationContext();
        context.setValidating(false);
        context.load("applicationContext.xml");
        context.refresh();
        log.info("★★★★★★★★ ApplicationContext = {}", context);
        int i = 1;
        for (String beanName : context.getBeanDefinitionNames())
        {
            log.info("{}.\t{}", i, beanName);
            i++;
        }
        UsersService usersService = context.getBean(UsersService.class);
        TMeasureService measureService = context.getBean(TMeasureService.class);
        TMeasureDAO tMeasureDAO = context.getBean(TMeasureDAO.class);
        usersService.queryAll();
        measureService.queryAll();
        tMeasureDAO.selectAll();
        context.close();
    }
}
